/*
 * The RavenX Library
 * Copyright (c) 2008 by Solidus
 * 
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  Hewlett-Packard Company makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 */

#ifndef RX_SPEC_H
#define RX_SPEC_H


#include "rx_config.h"
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>

RX_SPACE_BEG

#if defined(_MSC_VER) || defined(__BORLANDC__)

#define __RX_WIDE_STR(_String) L ## _String
#define RX_WIDE_STR(_String) __RX_WIDE_STR(_String)


#define __RX_APPEND_STR(_Value1, _Value2) _Value1 ## _Value2
#define RX_APPEND_STR(_Value1, _Value2) __RX_APPEND_STR(_Value1, _Value2)


#define __RX_STRINGIZE_STR(_Value) #_Value
#define RX_STRINGIZE_STR(_Value) __RX_STRINGIZE_STR(_Value)

#define RX_LARGE_NUM(num) (n)

#define RX_I64_FMT		"I64"

#endif



#if defined(_MSC_VER)



#if (_MSC_VER < 1300)

#define rx_vsprintf(buf, nelems, fmt, arg_ptr)		do{vsprintf(buf, fmt, arg_ptr);}while(0)

#define rx_vswprintf	vswprintf

#define rx_vscprintf(fmt, args)			(4096)

#define rx_vscwprintf(fmt, args)		(4096)


#define RX__FUNC__NAME__	"--"

#else


#define rx_vsprintf				vsprintf_s

#define rx_vswprintf			vswprintf_s

#define rx_vscprintf			_vscprintf

#define rx_vscwprintf			_vscwprintf


#define RX__FUNC__NAME__	__FUNCSIG__

#endif


#define rx_sprintf		sprintf

#define rx_swprintf		swprintf

#define rx_sscanf		sscanf

#define rx_swscanf		swscanf



#elif defined(__BORLANDC__)


#define rx_sprintf		sprintf

RX_INLINE int rx_swprintf(wchar_t *buffer,  size_t count, const wchar_t *fmt, ...)
{
        int res;
        va_list  arg_ptr;
        va_start(arg_ptr, fmt);
        res = vwprintf(fmt, arg_ptr);
        va_end(arg_ptr);
        return res;
}


#define rx_vsprintf(buf, count, fmt, args)	        vsprintf(buf, fmt, args)

#define rx_vswprintf(buf, count, fmt, args)	        vswprintf(buf, fmt, args)


#define rx_vscprintf(fmt, args)		        	(4096)

#define rx_vscwprintf(fmt, args)	        	(4096)


#define rx_sscanf		sscanf

#define rx_swscanf		swscanf


#define RX__FUNC__NAME__			__FUNC__


#else

#error "Unkonw Platform"



#endif



RavenAPI void rx_debug_break();

#define RX_DEBUGGER_TRIGGER rx_debug_break


int __wstr_to_cstr(const wchar_t *str, char *dest);

int __wstr_to_cstr_utf8(const wchar_t *str, char *dest);

int __cstr_to_wstr(const char *str, wchar_t *dest);















RX_SPACE_END


















#endif






















